package com.element.security.model;

import org.springframework.security.core.GrantedAuthority;
import org.springframework.util.CollectionUtils;

import java.io.Serializable;
import java.util.Set;

public class ScopeGrantedAuthority implements GrantedAuthority, Serializable {

    private static final long serialVersionUID = 1L;

    private String scope;

    private Set<String> apis;

    public ScopeGrantedAuthority() {

    }

    public ScopeGrantedAuthority(String scope, Set<String> apis) {
        this.scope = scope;
        this.apis = apis;
    }

    @Override
    public String getAuthority() {
        return this.scope;
    }

    public Set<String> getApis() {
        return apis;
    }

    public boolean isEmpty() {
        return CollectionUtils.isEmpty(apis);
    }
}